package com.dongdongshop.controller;

import com.dongdongshop.api.SellerServiceApi;
import com.dongdongshop.data.Result;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("adminSeller")
@CrossOrigin  //跨域
@Api("运营商后台管理——商家审核")
@RefreshScope   //自动监听配置文件
@Slf4j
public class SellerController {

    @Autowired
    private SellerServiceApi sellerServiceApi;

    //查询全部
    @PostMapping("sellerList")
    public Result sellerList() {
        return sellerServiceApi.sellerList();
    }

    //回显/根据id查询商家信息
    @PostMapping("sellerByName")
    public Result selectByName(@RequestParam String sellerId) {
        return sellerServiceApi.selectByName2(sellerId);
    }

    //更改商家的状态
    @PostMapping("updateState")
    public Result updateState(@RequestBody String sellerId, @RequestParam int state) {
        return sellerServiceApi.updateState(sellerId,state);
    }

}
